package com.lmk.work;

import java.io.*;

public class Copy {
    public static void main(String[] args) {
        String oldPath="d:/11/a/test.txt";
        String newPath="d:/11/a/test1.txt";
        File old=new File(oldPath);
        File target=new File(newPath);
        try(
                InputStream inputStream=new FileInputStream(old) ;
                OutputStream outputStream=new FileOutputStream(target);
                ) {


            byte[] bytes=new byte[10000];
            int len=-1;
            while ((len= inputStream.read(bytes))!=-1){
                outputStream.write(bytes,0, len);
            }
            outputStream.flush();
        }catch (Exception e){
            e.printStackTrace();
        }
    }
}
